package com.ruoyi.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.OrderqaInfo;
import com.ruoyi.system.service.IOrderqaInfoService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 【请填写功能名称】Controller
 *
 * @author ruoyi
 * @date 2025-02-12
 */
@RestController
@RequestMapping("/system/info")
@Api(tags = "无纸化订单审核接口")
public class OrderqaInfoController extends BaseController
{
    @Autowired
    private IOrderqaInfoService orderqaInfoService;

    /**
     * 查询【请填写功能名称】列表
     */
    @PreAuthorize("@ss.hasPermi('system:info:list')")
    @ApiOperation("分页查询")
    @PostMapping("/list")
    public TableDataInfo list(@RequestBody OrderqaInfo orderqaInfo, @RequestParam Integer pageNum, @RequestParam Integer pageSize)
    {
        List<OrderqaInfo> list = orderqaInfoService.selectOrderqaInfoList(orderqaInfo,pageNum,pageSize);
        Long total = orderqaInfoService.selectOrderqaInfoCount(orderqaInfo);
        return getDataTable(list,total);
    }

    /**
     * 导出【请填写功能名称】列表
     */
    @PreAuthorize("@ss.hasPermi('system:info:export')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
    @ApiOperation("Execl导出")
    @PostMapping("/export")
    public void export(HttpServletResponse response, OrderqaInfo orderqaInfo)
    {
        List<OrderqaInfo> list = orderqaInfoService.selectOrderqaInfoAll(orderqaInfo);
        ExcelUtil<OrderqaInfo> util = new ExcelUtil<OrderqaInfo>(OrderqaInfo.class);
        util.exportExcel(response, list, "【请填写功能名称】数据");
    }

    /**
     * 获取【请填写功能名称】详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:info:query')")
    @GetMapping(value = "/{id}")
    @ApiOperation("获取一条数据通过Id")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(orderqaInfoService.selectOrderqaInfoById(id));
    }
    @PreAuthorize("@ss.hasPermi('system:info:query')")
    @GetMapping(value = "/getOrderQaFromOrderNo")
    @ApiOperation("获取一个订单号的数据")
    public AjaxResult getOrderQaFromOrderNo(@RequestParam String orderNo )
    {
        return success(orderqaInfoService.getOrderQaFromOrderNo(orderNo));
    }

    /**
     * 新增【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('system:info:add')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ApiOperation("新增")
    public AjaxResult add(@RequestBody OrderqaInfo orderqaInfo)
    {
        return toAjax(orderqaInfoService.insertOrderqaInfo(orderqaInfo));
    }

    /**
     * 修改【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('system:info:edit')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
    @PutMapping("/update")
    @ApiOperation("修改")
    public AjaxResult edit(@RequestBody OrderqaInfo orderqaInfo)
    {
        return toAjax(orderqaInfoService.updateOrderqaInfo(orderqaInfo));
    }

    /**
     * 删除【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('system:info:remove')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    @ApiOperation("删除")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(orderqaInfoService.deleteOrderqaInfoByIds(ids));
    }
}
